package com.xbao.dao;

import com.xbao.model.VStu;
import com.xbao.model.VStuExample;
import java.util.List;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface VStuMapper {
    @SelectProvider(type=VStuSqlProvider.class, method="countByExample")
    int countByExample(VStuExample example);

    @DeleteProvider(type=VStuSqlProvider.class, method="deleteByExample")
    int deleteByExample(VStuExample example);

    @Insert({
        "insert into v_stu (name, birthday, ",
        "tel, mobile, comments, ",
        "type, headurl, stuno, ",
        "sex, address, weixin, ",
        "createtime, updatetime, ",
        "status, flag, orgid)",
        "values (#{name,jdbcType=VARCHAR}, #{birthday,jdbcType=BIGINT}, ",
        "#{tel,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{comments,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=INTEGER}, #{headurl,jdbcType=VARCHAR}, #{stuno,jdbcType=INTEGER}, ",
        "#{sex,jdbcType=INTEGER}, #{address,jdbcType=VARCHAR}, #{weixin,jdbcType=VARCHAR}, ",
        "#{createtime,jdbcType=BIGINT}, #{updatetime,jdbcType=BIGINT}, ",
        "#{status,jdbcType=INTEGER}, #{flag,jdbcType=INTEGER}, #{orgid,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(VStu record);

    @InsertProvider(type=VStuSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(VStu record);

    @SelectProvider(type=VStuSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="birthday", property="birthday", jdbcType=JdbcType.BIGINT),
        @Result(column="tel", property="tel", jdbcType=JdbcType.VARCHAR),
        @Result(column="mobile", property="mobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="comments", property="comments", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="headurl", property="headurl", jdbcType=JdbcType.VARCHAR),
        @Result(column="stuno", property="stuno", jdbcType=JdbcType.INTEGER),
        @Result(column="sex", property="sex", jdbcType=JdbcType.INTEGER),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="weixin", property="weixin", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="flag", property="flag", jdbcType=JdbcType.INTEGER),
        @Result(column="orgid", property="orgid", jdbcType=JdbcType.BIGINT)
    })
    List<VStu> selectByExample(VStuExample example);

    @UpdateProvider(type=VStuSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") VStu record, @Param("example") VStuExample example);

    @UpdateProvider(type=VStuSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") VStu record, @Param("example") VStuExample example);
}